﻿using FluentValidation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace TL_Cloud.ViewModels.BookShop
{
    /// <summary>
    /// 用户登陆的ViewModel
    /// </summary>
    public class LoginViewModel
    {
        /// <summary>
        /// 用户账号
        /// </summary>
        public string userName { get; set; }
        /// <summary>
        /// 用户密码
        /// </summary>
        public string password { get; set; }
    }
    public class LoginViewModelValidtor<T> : AbstractValidator<T>
       where T : LoginViewModel
    {
        public LoginViewModelValidtor()
        {
            RuleFor(x => x.userName)
                 .NotNull()
                 .WithName("用户名")
                 .WithMessage("required|{PropertyName}是必填的");
            RuleFor(x => x.password)
                .NotNull()
                 .WithName("密码")
                .WithMessage("required|{PropertyName}是必填的");
        }

    }
}
